﻿using System.Windows;
using Microsoft.Practices.Unity;
using XClient.Common;
using XClient.Controls;

namespace XClient
{
    /// <summary>
    /// Interaction logic for Shell.xaml
    /// </summary>
    public partial class Shell : Window, IShellView
    {
        #region · Fields ·

        private IShellPresenter presenter;
        private IUnityContainer container;
        private TryIcon         tryIcon;

        #endregion

        #region · Properties ·

        public IShellPresenter Presenter
        {
            get { return this.presenter; }
            set
            {
                this.presenter = value;
            }
        }

        #endregion

        #region · Constructors ·

        public Shell(IUnityContainer container)
        {
            InitializeComponent();

            this.container = container;
        }

        #endregion

        #region · IShellView Members ·

        public void ShowView()
        {
            this.tryIcon = this.container.Resolve<TryIcon>();
            this.tryIcon.Initialize(this, Helpers.GetIconFromAplicationResource("pack://application:,,,/Resources/notifyicon.ico"));
            this.Show();
            this.Content.Content = this.container.Resolve<MainView>();
        }

        #endregion
    }
}
